//LayoutManager:布局管理器

function LayoutManager()
{
    var left = document.getElementById("LeftDiv");
    var right = document.getElementById("RightDiv");
    var btm = document.getElementById("BtmDiv");

    RePosAll();

    function RePosAll ()//重新放置界面
    {
        var VolumeCanvas = document.getElementById('VolRenderCanvas');

        //获取浏览器宽高
        var WindowWidth = document.documentElement.clientWidth;
        var WindowHeight = document.documentElement.clientHeight;

        //设置底面区域的宽
        btm.style.width=""+((WindowWidth-16)>(g_RenderSize+656)?(WindowWidth-16):(g_RenderSize+656))+"px";
        //设置底面区域和顶部距离
        btm.style.top=""+((g_RenderSize<=512? 512:g_RenderSize)+16)+"px";
        //设置底面区域中直方图区域的宽度
        document.getElementById("BtmMidDiv").style.width=""+(parseInt(btm.style.width)-656)+"px";

        //设置渲染视图。左右区域的横向位置
        if(WindowWidth>(8+320+8+g_RenderSize+8+320+8))
        {
            VolumeCanvas.style.left = "" + (WindowWidth/2-g_RenderSize/2)+"px";
            right.style.right = "8px";
            right.style.left="auto";
        }
        else
        {
            VolumeCanvas.style.left = "" + (8+320+8)+"px";
            right.style.left = ""+(8+320+8+g_RenderSize+8)+"px";
        }


        //设置左右区域的高度
        var sideHeight =g_RenderSize;
        if(sideHeight>(WindowHeight-16))
            sideHeight = (WindowHeight-16);
        if(sideHeight<512)
            sideHeight = 512;
        left.style.height=""+sideHeight+"px";
        right.style.height=""+sideHeight+"px";

        //设置渲染视图的顶部距离
        if(g_RenderSize<512)
            VolumeCanvas.style.top=""+(8+256-g_RenderSize/2)+"px";
        else
            VolumeCanvas.style.top="8px";

    }

    this.RePos = function()//此函数会被外部调用
    {
        RePosAll ();
    }

    window.onresize=function()//每次浏览器改变大小的时候都会调用
    {
        RePosAll();
    }
}

